<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="renderer" content="webkit">
    <title><?php echo ($title); ?></title>
    <link rel="stylesheet" href="/Public/web/css/pintuer.css">
    <link rel="stylesheet" href="/Public/web/css/admin.css">
    <script src="/Public/web/js/jquery.js"></script>
    <script src="/Public/web/js/pintuer.js"></script>
</head>

<script type="text/javascript" src="/Public/web/layer/layer.js"></script>
<script type="text/javascript" src="/Public/web/jquery-validation-1.14.0/lib/jquery.form.js"></script>
<script type="text/javascript" src="/Public/web/jquery-validation-1.14.0/dist/jquery.validate.min.js"></script>
<link rel="stylesheet" href="/Public/web/css/main.css"/>
<link rel="stylesheet" type="text/css" href="/Public/web/css/index1.css">
<link rel="stylesheet" href="/Public/web/css/index2.css"/>
<link rel="stylesheet" href="/Public/web/css/iphone_css.css"/>
<style>
    .error{
        color: #ff0000;
    }
</style>
<body>
    <div class="formbody">
        <div class="formtitle" style="height: 50px;line-height: 50px;">
            <?php if(is_array($view_title)): $i = 0; $__LIST__ = $view_title;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?><a href="<?php echo U('Design/index',array('id'=>$v['view_id']));?>"><span><?php echo ($v["view_name"]); ?></span></a><?php endforeach; endif; else: echo "" ;endif; ?>
        </div>
        <hr>
        <div class="forminfo" style="display: block;">
            <!--<div class="iphone-body">
                <div class="iphone-title" style='position: absolute;background-color: <?php echo ($info_option["title_color"]); ?>;'>
                    <?php if($info_option['title']): echo ($info_option['title']); else: echo L('weimingming'); endif; ?>
                </div>
                <div id="box" style="width: 100%;min-height:500px;background: rgb(220,220,220);">
                
                </div>
            </div>-->
            <div class="device-ios" style="background-size:100% 100%;background-image: url(/Public/images/iphone.png)">
                <div style="position: relative;">
                  <div class="device-screen">
                    <div class="wx_title" name="sub_ground" data-value="no_delete" style="position: absolute;background-color:<?php echo ($info_option['title_color']); ?>; ">
                      <div style="float:left;height:20px;width:30px;padding-left:5px;margin: 6px 0px;">
                        <img style="width:100%;height:100%" src="/Public/images/back.png"/>
                      </div>

                      <div name="text_input" class="text_input" style="float:left;line-height:30px;text-align:center;font-size:15px;width:189px;<?php if($info_option['TextStyle']): ?>color:<?php echo ($info_option["TextStyle"]); else: ?>color:#fff<?php endif; ?>">
                        <?php if($info_option['title']): echo ($info_option['title']); else: echo L('weimingming'); endif; ?>
                      </div>

                      <div style="float:right;height:30px;width:30px;">
                        <img style="width:100%;height:100%" src="/Public/images/more.png"/>
                      </div>
                    </div>

                    <div class="wx_content" style="margin-top: 35px;">
                        <?php echo ($first); ?>
                    </div>
                  </div>
                </div>
            </div>
            <form id="form" method="post" action="<?php echo U('Design/save');?>" enctype="multipart/form-data">
                <div style="float:left;width:494px;height:auto;background:#fdfdfd;padding:15px 10px;margin-left:18px;border:1px solid #ddd;border-radius:5px;margin-top:0;">
                        <div class="layui-form-item">
                            <label class="layui-form-label">主题色</label>
                            <div class="layui-input-block">
                                <input type="color" name="title_color" onchange="change_color(this)" style="width: 38px;height: 38px;line-height: 38px;border: none;" value="#000000" />
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">输入标题</label>
                            <div class="layui-input-block">
                                <input type="text" id="title" name="title" oninput="change_title(this)" class="layui-input"/>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">标题颜色</label>
                            <div class="layui-input-block">
                                <input type="color" name="TextStyle" onchange="Text_Style(this)" style="width: 38px;height: 38px;line-height: 38px;border: none;" value="#ffffff" />
                            </div>
                        </div>
                </div>
                <div class="detail" <?php if($first_detail): ?>style="display:block;"<?php endif; ?>>
                    <?php echo ($first_detail); ?>
                </div>
                <input type="hidden" name="template_id" value=""/>
                <input type="hidden" name="pid" value="<?php echo ($view_id); ?>"/>
            </form>
            <div class="nav-bottom">
                <ul>
                    <?php if(is_array($view_name)): $i = 0; $__LIST__ = $view_name;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><li onclick="get_connent(<?php echo ($vo['view_id']); ?>)">+<?php echo ($vo["view_name"]); ?></li><?php endforeach; endif; else: echo "" ;endif; ?>
                </ul>
                <div style="clear: both;height: 50px;border-top: 1px dashed rgb(220,220,220);">
                    <div style="width: 50px;height: 20px;border-radius: 3px; float: right;margin-right: 5px;background-color: #1ab394;border-color: #1ab394;color: #FFFFFF;text-align: center;line-height: 20px;cursor: pointer;margin-top: 15px;" onclick="$('#form').submit()">保 存</div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>
<script type="text/javascript">
    $(function(){
        $('.title_color').val('rgb(255,255,255)');

        $('#form').validate({
            rules:{
                title:'required',
            },
            messages:{
                title:"请输入标题",
            },
            submitHandler: function(form){
                $(form).ajaxSubmit(function(msg){
                    if(msg.code == 1){layer.msg(msg.messages)}else if(msg.code==0){layer.msg(msg.messages)}
                });
            }
        });




    });

    function change_color(data){
        $('.wx_title').css('background-color',$(data).val());
        $('.wx_bottom .bottom_01').eq(0).css('color',$(data).val());
    }

    function Text_Style(data){
        $('.text_input').css('color',$(data).val());
    }

    <?php if($sum_option): ?>var config = <?php echo ($sum_option); ?>;
        for( var key in config){
            if( $('input[name='+key+']').attr('type') != 'file'){
                $('input[name='+key+']').val(config[key]);
            }
        }<?php endif; ?>

    function get_connent(id){
        $.get('<?php echo U("Design/display_view");?>',{'id':id},function(msg){
            $('.wx_content').html(msg.info);
            $('.detail').html(msg.detail);
            $('.detail').show();
            $('input[name=template_id]').val(msg.id);
            $('.wx_title').css('background-color','#000000');
            $('input[name=title_color]').val('#000000');
            $('input[name=title]').val("<?php echo L('weimingming');?>");
            $('div[name=text_input]').html("<?php echo L('weimingming');?>");
        },'json');
    }


    

    function change_title(data){
        $('div[name=text_input]').html($(data).val());
    }




</script>